import request from "@/utils/request"

//文章详情页
export const articleDetailAPI = ({
  art_id
}) => request({
  url: `/v1_0/articles/${art_id}`
})

//文章评论列表
export const commentListAPI = ({
  id,
  offset,
  limit
}) => request({
  url: '/v1_0/comments',
  params: {
    type: 'a',
    source: id,
    offset,
    limit
  }
})

//文章评论点赞
export const commentLikeAPI = ({
  id
}) => request({
  url: '/v1_0/comment/likings',
  method: 'POST',
  data: {
    target: id
  }
})

//文章评论取消点赞
export const commentDisLikeAPI = ({
  id
}) => request({
  url: `/v1_0/comment/likings/${id}`,
  method: 'DELETE'
})

//文章评论发布
export const commentSendAPI = ({
  id,
  text
}) => request({
  url: '/v1_0/comments',
  method: 'POST',
  data: {
    target: id,
    content: text
  }
})
